<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>信科买卖</title>
<link rel="stylesheet" href="/student/css/bootstrap.css">
<script src="/student/js/jquery-1.11.0.min.js"></script>
<script src="/student/js/bootstrap.min.js"></script>
<script type="text/javascript" src="jQuery/mainPage_js.js"></script>
</head>
<script>
	var goodId = 1;
	$.ajax({
		type : "post",
		url : "<c:url value='/NewsServlet?method=newsJson'/>",          //servlet需要提前在web.xml里面注册
		dataType : "json",
		data :{},
		success : function(data,textStatus)
		{
            //data为后端post函数传递来的数据，这里写结果操作代码
			var objs = eval(data);  //解析json对象
			for(var i = 0;i<objs.length;i++)
			{
			if(objs[i].newsid!=goodId++ ||objs[i].newsimg=='')                                  //解决用户下架的问题；关键代码；
			{	
				$("#"+ --goodId).hide();													//解决用户准备上架的问题；关键代码；
				$("#"+ goodId).parent().hide();
				goodId++;
				continue;
			}
			else{
			$("#"+objs[i].newsid).before("<img src="+objs[i].newsimg+" alt='图片加载失败'/>");
			$("#"+objs[i].newsid+"_title").text(objs[i].newstitle);
			$("#"+objs[i].newsid+"_content").text(objs[i].newscontent);
			$("#"+objs[i].newsid+"_authod").text(objs[i].newsauthod);
			$("#"+objs[i].newsid+"_tell").text("Tel:"+objs[i].tell);
			}
			}
		},
		error : function(xhr, status, errMsg)
		{
			alert("数据传输失败!");
		}
});


</script>
<body onLoad="showName()">
	<div class="container ">
		<head class="header">
<!-- 导航栏 -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"
	style="background-image:linear-gradient(to right, #c80000 ,#800000);">
<div class="container ">
	<div class="navbar-header">
		<button type="button" class="navbar-toggle" data-toggle="collapse"
			data-target="#navbar-collapse">
			<span class="sr-only">切换导航</span> <span class="icon-bar"></span> <span
				class="icon-bar"></span> <span class="icon-bar"></span>
		</button>
		<a class="navbar-brand brand " href="#" id="userName">信科买卖 </a>
	</div>
	<div class="collapse navbar-collapse " id="navbar-collapse">
		<ul class="nav navbar-nav navbar-right">
			<li><a href="#frist">大一杂货</a></li>
			<li><a href="#second">大二杂货</a></li>
			<li><a href="#third">大三杂货</a></li>
			<li><a href="#fourth">大四杂货</a></li>
			<li><a id="myZone">我的发布</a></li>
		</ul>
	</div>
</div>
</nav>
		</head>

		<br /> <br /> <br /> <br /> <br />

		<div class="container text-center">
			<div class="row">

				<h3>赶快登陆，联系管理员</h3>
				<h1><a href="<c:url value='/user-view/admin/login.jsp'/>">管理员登录入口</a></h1>
				<h3>发布自己的闲置物品吧</h3>
				<h1><a href="<c:url value='/thing/addThing.jsp'/>">物品发布入口</a></h1>
				<h3>发布新闻吧</h3>
				<h1><a href="<c:url value='/news/add.jsp'/>">新闻发布入口</a></h1>


				<a class="btn btn-warning " href="user-view/login.jsp">LoginNow</a> 
				<a class="btn btn-default " href="user-view/regist.jsp">SignUp</a>

			</div>
		</div>
		<br /> <br /> <br />
		<hr />
	</div>
	<div class="container text-center col-md-12 col-sm-12">
		<h3 style="color: #800000" id="Team">我们的商品</h3>
		<br> <br>
	</div>

	<div class="container ">
		<div class="row">
			<h3 id="frist">大一杂货</h3>
			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="1" class="caption">

						<h4 id="1_title" style="color: #CC6600"></h4>
						<h5 id="1_content"></h5>

						<button class="btn btn-info" id="1_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="1_tell"></h6>

					</div>
				</div>
			</div>

			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="2" class="caption">

						<h4 id="2_title" style="color: #CC6600"></h4>
						<h5 id="2_content"></h5>

						<button class="btn btn-info" id="2_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="2_tell"></h6>

					</div>
				</div>
			</div>

			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="3" class="caption">

						<h4 id="3_title" style="color: #CCFF00"></h4>
						<h5 id="3_content"></h5>

						<button class="btn btn-info" id="3_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="3_tell"></h6>

					</div>
				</div>
			</div>

			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="4" class="caption">

						<h4 id="4_title" style="color: #CCFF00"></h4>
						<h5 id="4_content"></h5>

						<button class="btn btn-info" id="4_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="4_tell"></h6>

					</div>
				</div>
			</div>
		</div>

		<hr />
		<div class="row">
			<h3 id="second">大二杂货</h3>
			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="5" class="caption">

						<h4 id="5_title" style="color: #CC0066"></h4>
						<h5 id="5_content"></h5>

						<button class="btn btn-info" id="5_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="5_tell"></h6>

					</div>
				</div>
			</div>

			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="6" class="caption">

						<h4 id="6_title" style="color: #CC3333"></h4>
						<h5 id="6_content"></h5>

						<button class="btn btn-info" id="6_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="6_tell"></h6>

					</div>
				</div>
			</div>

			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="7" class="caption">

						<h4 id="7_title" style="color: #CC3333"></h4>
						<h5 id="7_content"></h5>

						<button class="btn btn-info" id="7_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="7_tell"></h6>

					</div>
				</div>
			</div>

			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="8" class="caption">

						<h4 id="8_title" style="color: #CC6633"></h4>
						<h5 id="8_content"></h5>

						<button class="btn btn-info" id="8_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="8_tell"></h6>

					</div>
				</div>
			</div>
		</div>
		<hr />
		<div class="row">
			<h3 id="third">大三杂货</h3>
			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="9" class="caption">

						<h4 id="9_title" style="color: #CC6633"></h4>
						<h5 id="9_content"></h5>

						<button class="btn btn-info" id="9_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="9_tell"></h6>

					</div>
				</div>
			</div>

			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="10" class="caption">

						<h4 id="10_title" style="color: #CC6633"></h4>
						<h5 id="10_content"></h5>

						<button class="btn btn-info" id="10_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="10_tell"></h6>

					</div>
				</div>
			</div>

			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="11" class="caption">

						<h4 id="11_title" style="color: #CC6633"></h4>
						<h5 id="11_content"></h5>

						<button class="btn btn-info" id="11_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="11_tell"></h6>

					</div>
				</div>
			</div>

			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="12" class="caption">

						<h4 id="12_title" style="color: #CC6633"></h4>
						<h5 id="12_content"></h5>

						<button class="btn btn-info" id="12_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="12_tell"></h6>

					</div>
				</div>
			</div>
		</div>
		<hr />
		<div class="row">
			<h3 id="fourth">大四清仓</h3>
			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="13" class="caption">

						<h4 id="13_title" style="color: #CC6633"></h4>
						<h5 id="13_content"></h5>

						<button class="btn btn-info" id="13_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="13_tell"></h6>

					</div>
				</div>
			</div>

			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="14" class="caption">

						<h4 id="14_title" style="color: #CC6633"></h4>
						<h5 id="14_content"></h5>

						<button class="btn btn-info" id="14_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="14_tell"></h6>

					</div>
				</div>
			</div>

			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="15" class="caption">

						<h4 id="15_title" style="color: #CC6633"></h4>
						<h5 id="15_content"></h5>

						<button class="btn btn-info" id="15_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="15_tell"></h6>

					</div>
				</div>
			</div>

			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="16" class="caption">

						<h4 id="16_title"></h4>
						<h5 id="16_content"></h5>

						<button class="btn btn-info" id="16_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="16_tell"></h6>

					</div>
				</div>
			</div>
			
			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="17" class="caption">

						<h4 id="17_title"></h4>
						<h5 id="17_content"></h5>

						<button class="btn btn-info" id="17_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="17_tell"></h6>

					</div>
				</div>
			</div>
			
			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="18" class="caption">

						<h4 id="18_title"></h4>
						<h5 id="18_content"></h5>

						<button class="btn btn-info" id="18_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="18_tell"></h6>

					</div>
				</div>
			</div>
			
			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="19" class="caption">

						<h4 id="19_title"></h4>
						<h5 id="19_content"></h5>

						<button class="btn btn-info" id="19_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="19_tell"></h6>

					</div>
				</div>
			</div>
			
			<div class="col-md-3 col-sm-6">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="20" class="caption">

						<h4 id="20_title"></h4>
						<h5 id="20_content"></h5>

						<button class="btn btn-info" id="20_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="20_tell"></h6>

					</div>
				</div>
			</div>
			
			
		</div>


	</div>



	<input type="text" id="userFlag" value="${user.userName }" style="display: none">
	<div class="container text-center">
		<!-- 页脚 -->
		<h6>版权&copyIT伟龙小分队</h6>
	</div>
</body>
</html>